package cn.gene.timeyan.ums.webapi.ums.controller;

import cn.gene.timeyan.common.restful.JsonResult;
import cn.gene.timeyan.pojo.coo.dto.CooperationDeleteDTO;
import cn.gene.timeyan.pojo.ums.vo.BrowsingHistoryVO;
import cn.gene.timeyan.ums.service.IBrowsingHistoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 浏览记录    前端控制器*
 *
 * @author LWG
 * @date 2022/7/23 11:05
 * @since 1.0.0@gene.cn
 */
@RestController
@RequestMapping("/ums/BrowsingHistory")
@Api(tags="浏览记录模块")
public class BrowsingHistoryController {
    @Autowired
    private IBrowsingHistoryService browsingService;
    @GetMapping("/list")
    @ApiOperation("查看浏览历史记录列表")
    public JsonResult<List<BrowsingHistoryVO>> browsingHistoryList(@RequestParam Long userId,@RequestParam Integer page){
        List<BrowsingHistoryVO> list=browsingService.browsingHistoryList(userId,page);
        return JsonResult.ok(list);
    }
    @PostMapping("/delete")
    @ApiOperation("删除某条记录")
    public JsonResult<Void> deleteBrowsingHistory(CooperationDeleteDTO cooperationDeleteDTO){
        browsingService.deleteBrowsingHistory(cooperationDeleteDTO);
        return JsonResult.ok();
    }
}
